package com.zhoudy.segmetlock;

import java.util.concurrent.CountDownLatch;

class  Worker implements Runnable{
    private CountDownLatch downLatch;
    private TransferData instance;

    Worker( TransferData instance,CountDownLatch downLatc){
        this.downLatch = downLatc;
        this.instance = instance;
    }

    @Override
    public void run() {
        for (int i = 0; i < instance.getDataSegmentCnt(); i++) {
            instance.transfer("seg" + i);
        }
        downLatch.countDown();
    }
}
